<?php 

function apiReturn($code='-1',$msg,$data=[]){

        $code = (string)$code;
        if($code == '-1'){
            exit('参数调用错误');
        }
        if(empty($data)){
            exit(json_encode(array('code'=>$code,'msg'=>$msg,'data'=>$data)));
        }else{
            exit(json_encode(array('code'=>$code,'msg'=>$msg,'data'=>$data)));
        }

}

function  diffBetweenTwoDays($day1,$day2){
    $sone = strtotime($day1);
    $stwo = strtotime($day2);
    if($sone < $stwo)
    {
        $tmp = $stwo;
        $stwo = $sone;
        $sone = $tmp;
    }
    return ($sone - $stwo) / 86400;
}

function getNextMothLastDay()
{
	$first_day=date('Y-m-01',time());
    return  date('Y-m-d',strtotime("$first_day +2 month -1 day"));
}



